package br.edu.udc.sistemas.ia5.session;

import br.edu.udc.sistemas.ia5.dao.Dao;
import br.edu.udc.sistemas.ia5.entity.Entity;

public class Session {
	
	protected Dao dao;
	
	public Session(Dao dao) throws Exception {
		this.dao = dao;
	}
	public void save (Entity obj) throws Exception {
		this.dao.save(obj);
		this.dao.commit();
	}

	public void delete (Entity obj) throws Exception {
		this.dao.delete(obj);
		this.dao.commit();
	}
	
	public Entity[] find(Entity obj) throws Exception {
		return this.dao.find(obj);
		
	} 
	
	public Entity findByPrimaryKey(Entity obj) throws Exception {
		return this.dao.findByPrimaryKey(obj);
	}
}
